In [1]:
import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
from sympy import *
from sympy.matrices import *
init_printing()
In [2]:
b = symbols('b')
b = Matrix([[1, -4],
[2, -3]])
b
Out[2]:
In [3]:
b.eigenvects()
Out[3]:
La matriz b por el vector [y1 y2] es igual a cualquier eigenvalor (e.g. $ -1 + 2i $) por [y1 y2].
$$ \left[\begin{array}{cc} 1 & -4\\ 2 & -3 \end{array}\right]\left[\begin{array}{c} y_{1}\\ y_{2} \end{array}\right]=-1+2i\left[\begin{array}{c} y_{1}\\ y_{2} \end{array}\right] $$De ahí se despeja este sistema de ecuaciones redundantes:
$$ (-1 + 2i)y_1 - (y_1 - 4y_2)=0 $$y
$$ (-1 + 2i)y_2 - (2y_1 - 3y_2)=0 $$Despejando $ y_2 $ en una y otra:
In [4]:
y1, y2 = symbols("y1 y2")
solve(((-1 + 2j) * y1) - (y1 - 4 * y2),
y1)
Out[4]:
In [5]:
solve(((-1 + 2j) * y2) - (2 * y1 - 3 * y2),
y2)
Out[5]:
In [6]:
x, y = symbols("x y")
b * Matrix([x, y])
Out[6]:
In [7]:
x, y = np.meshgrid(np.linspace(-40, 40, 14),
np.linspace(-40, 40, 14))
u = x - 4 * y
v = 2 * x - 3 * y
plt.quiver(x, y, u, v)
plt.show()